<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
</head>
<body>
<table width="100%" border="1" class="table_sum">
    <tr><td colspan="3">产品2号(table的class=num_sum)</td></tr>
    <tr>
        <td>单价</td>
        <td>数量</td>
        <td>小计bai</td>
    </tr>
    <tr class="jisuan">
        <td>10</td>
        <td><input type="text" size="30" /></td>
        <td></td>
    </tr>
    <tr>
        <td>合计</td>
        <td id="sum" colspan="2" align="center"></td>
    </tr>
</table>
</body>
</html>
<script>
    $(function(){
        var sum=0;
        $(".jisuan input").keyup(function(e) {
            var shuliang = $(this).val();
            var danjia = $(this).parent().prev().text();
            var xiaoji =$(this).parent().next();
            xiaoji.text(shuliang*danjia);
            xiaoji.each(function(index, element) {
                sum+=parseInt($(this).text());
            });
            $("#sum").text(sum);
        })
    })
</script>